package org.domeos.framework.api.model.storage;

import org.domeos.framework.api.model.auth.related.Role;
import java.util.Comparator;

/**
 * Created by KaiRen on 2016/10/13.
 */
public class StorageInfo {
    private String name;
    private int id;
    private String description;
    private int creatorId;
    private String creatorName;
    private long createTime;
    private int memberCount;
    private int podCount;
    private String type;
    private String path;
    private String server;
    private int clusterId;
    private Role role;
    private String namespace;

    public StorageInfo() {
    }

    public StorageInfo(Storage storage) {
        setDescription(storage.getDescription());
        setCreateTime(storage.getCreateTime());
        setCreatorId(storage.getCreatorId());
        setId(storage.getId());
        setName(storage.getName());
        setType(storage.getType());
        setPath(storage.getPath());
        setServer(storage.getServer());
        setClusterId(storage.getClusterId());
        setNamespace(storage.getNamespace());
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public int getCreatorId() {
        return creatorId;
    }

    public void setCreatorId(int creatorId) {
        this.creatorId = creatorId;
    }

    public String getCreatorName() {
        return creatorName;
    }

    public void setCreatorName(String creatorName) {
        this.creatorName = creatorName;
    }

    public long getCreateTime() {
        return createTime;
    }

    public void setCreateTime(long createTime) {
        this.createTime = createTime;
    }

    public int getMemberCount() {
        return memberCount;
    }

    public void setMemberCount(int memberCount) {
        this.memberCount = memberCount;
    }

    public Role getRole() {
        return role;
    }

    public void setRole(Role role) {
        this.role = role;
    }

	public int getPodCount() {
		return podCount;
	}

	public void setPodCount(int podCount) {
		this.podCount = podCount;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getPath() {
		return path;
	}

	public void setPath(String path) {
		this.path = path;
	}

	public String getServer() {
		return server;
	}

	public void setServer(String server) {
		this.server = server;
	}

	public int getClusterId() {
		return clusterId;
	}

	public void setClusterId(int clusterId) {
		this.clusterId = clusterId;
	}


	public String getNamespace() {
		return namespace;
	}

	public void setNamespace(String namespace) {
		this.namespace = namespace;
	}


	public static class DeployCollectionInfoListComparator implements Comparator<StorageInfo> {
        @Override
        public int compare(StorageInfo t1, StorageInfo t2) {
            if (t2.getCreateTime() - t1.getCreateTime() > 0) {
                return 1;
            } else if (t2.getCreateTime() - t1.getCreateTime() < 0) {
                return -1;
            } else {
                return 0;
            }
        }
    }
}
